package com.codi.fcloud.ufx.constant;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

/**
 * 账户查询的审批状态
 *
 * @author shi.pengyan
 * @version 1.0 2017-09-06 13:59
 * @since 1.0
 */
@Slf4j
public enum CheckFlag {

    INIT("0", "未审批"),
    PASS("1", "审批通过"),
    PASS_AND_AUDIT("2", "审批待复核"),
    NOT_PASS("3", "审批不通过"),
    REJECT("4", "审批驳回修改");

    @Setter
    @Getter
    private String code;

    @Setter
    @Getter
    private String desc;

    CheckFlag(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CheckFlag get(String code) {

        for (CheckFlag checkFlag : CheckFlag.values()) {
            if (StringUtils.equals(checkFlag.code, code)) {
                return checkFlag;
            }
        }

        log.warn("not found checkFlag [{}]", code);

        return null;
    }


}
